#include "second.h"
#include "ui_second.h"
#include <QDebug>

Second::Second(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Second)
{
    ui->setupUi(this);
}



Second::~Second()
{
    delete ui;
}

void Second::RecieveData(QString path,int index){
    this->path = path;
    this->index = index;
     ui->text123->setText(path);

      qDebug()<<"path = "<<path;
      qDebug()<<"index = "<<index;

      switch(index){
      case 0://哈希表(在此调用哈希表方法)


          break;
      case 1://二叉树（在此调用二叉树方法）

          break;
      case 2://双向链表（在此调用双向链表方法）

          break;
      default:
          break;
      }


}

void Second::SetHistogram(){

    //设置柱状图


    ui->widgetH->SetMaxValue(100);
    ui->widgetH->AddItem("大众",8);
    ui->widgetH->AddItem("奔驰",15);

}

void Second::SetPie(){

    //设置饼图
    QVector<SectorInfo> result;

    SectorInfo info;
    info.description = "已经出售";
    info.percent = 0.3*100;
    result.push_back(info);

    info.description = "剩余";
    info.percent = (1 - 0.3)*100;
    result.push_back(info);
    ui->widgetP->setData(result);

}





